package com.followmeandroid.models;

import com.followmeandroid.enums.PrintFriend;

import java.io.Serializable;
import java.util.UUID;

/**
 * <p>Title: Friend</p>
 * <p>Description: Class for storing friend objects
 * to be used by the current member.</p>
 * @author Adam Drews
 * @email adam.drews@my.uwrf.edu
 * @date 11/17/2014
 * @team Tyler Johnson
 * @email tyler.johnson@my.uwrf.edu
 * @team Nicholas Thorp
 * @email nicholas.thorp@my.uwrf.edu
 */
public class Friend implements Serializable{

    private UUID friendID;
    private String userName;
    private String firstName;
    private String lastName;
    private String middleInitial;
    private String email;
    private Location location; //will only be sent with a request for the time being?
    private static PrintFriend print = PrintFriend.EMAIL;

    /**
     * Default constructor
     */
    public Friend() {
    }

    /**
     * Constructor for a friend object.
     * @param ID        The UUID of the friend.
     * @param uName     The user name of the friend.
     * @param location  The location of the friend.
     */
    public Friend(UUID ID, String uName, Location location) {
        this.friendID = ID;
        this.userName = uName;
        this.location = location;
    }

    /**
     * Returns the UUID friend ID of this friend.
     * @return friendID     The UUID of the friend.
     */
    public UUID getFriendID() {
        return friendID;
    }

    /**
     * Returns the user name of the friend.
     * @return userName     The user name of the friend.
     */
    public String getUserName() {
        return userName;
    }

    /**
     * Returns the first name of the friend.
     * @return firstName    The friend's first name.
     */
    public String getFirstName() {
        return firstName;
    }

    /**
     * Returns the last name of the friend.
     * @return lastName     The friend's last name.
     */
    public String getLastName() {
        return lastName;
    }

    /**
     * Returns the middle initial of the friend.
     * @return middleInitial    The friend's middle initial.
     */
    public String getMiddleInitial() {
        return middleInitial;
    }

    /**
     * Returns the email address of the friend.
     * @return email        The friend's email address.
     */
    public String getEmail() {
        return email;
    }

    /**
     * Returns the last location of the friend.
     * @return location     The location of the friend.
     */
    public Location getLocation() {
        return location;
    }

    /**
     * Sets the content printed by the toString method using an enum.
     * @param in        The enum to denote the message printed.
     */
    public static void setPrint(PrintFriend in){
        print = in;
    }

    /**
     * Returns a string with the contents of one of the cases given.
     * @return email
     *         userName
     *         firstName
     *         firstName + " " + middleInitial + " " + lastName
     */
    @Override
    public String toString() {
        switch(print){
            case EMAIL:
                return email;
            case UNSERNAME:
                return userName;
            case FIRSTNAME:
                return firstName;
            case NAME:
                return firstName + " " + middleInitial + " " + lastName;
        }
        return userName;
    }
}
